package com.cn.yugan.Engine.Json;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.UnsupportedEncodingException;

/**
 * Created by Rover on 2016/10/10 .
 * Email 357319517@qq.com
 */
public class LoginJson {
    private boolean success;
    private String decs="";
    private byte[] bytes;

    public LoginJson(byte[] bytes) {
        this.bytes = bytes;
        init();
    }

    private void init() {
        try {
            JSONObject jsonObject = new JSONObject(new String(bytes, "UTF-8"));
            success = jsonObject.getBoolean("success");
            decs = jsonObject.getString("error");
        } catch (JSONException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }

    public boolean isSuccess() {
        return success;
    }

    public String getDecs() {
        return decs;
    }
}
